From 68917d13804741e323ac17b8b40e1e65b655160a Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Wed, 2 Nov 2005 11:24:49 +0100 Subject: [PATCH] Fix memory leak in domain cleanup spotted by doremifa in #xen. Signed-off-by: Anthony Liguori --- tools/console/daemon/io.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c index ef3f094d27..d4593f0d80 100644 --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -380,12 +380,21 @@ static void cleanup_domain(struct domain *d) if (!buffer_empty(&d->buffer)) return; - if (d->buffer.data) + if (d->buffer.data) { free(d->buffer.data); - d->buffer.data = NULL; - if (d->tty_fd != -1) + d->buffer.data = NULL; + } + + if (d->tty_fd != -1) { close(d->tty_fd); - d->tty_fd = -1; + d->tty_fd = -1; + } + + if (d->conspath) { + free(d->conspath); + d->conspath = NULL; + } + remove_domain(d); } -- 2.30.2